#FROM harbor.airqualitychina.cn:2229/public/yard-base:pandas
#FROM harbor.airqualitychina.cn:2229/public/python-centos7:v1
FROM harbor.airqualitychina.cn:2229/public/python:3.8.10-centos7.8

#ENV ENVIRONMENT prod
ENV PATH=$PATH:/data/deploy:/data/deploy/bin
WORKDIR /data/deploy
RUN mkdir -p /data/deploy/tmp/log

# 时区设置
# ENV TZ=Asia/Shanghai
# RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories \
# && apk -U upgrade && apk --update-cache --no-cache add tzdata && cp /usr/share/zoneinfo/${TZ} /etc/localtime && echo ${TZ} > /etc/timezone

# 为了保障所使用的库具有一致性，也为了加快镜像的构建速度，Docker镜像python3.8:flask-yard中已经预装了yard-base所需要的库，无特殊需要建议不要重复安装
# 本镜像是基于官方python:3.8-alpine3.15镜像做的，在不安装额外库的情况下，本镜像的构建仅需3秒。
# 如有安装需降序求，请直接添加 RUN pip3 isntall
# 例如：
# RUN pip3 install --no-cache-dir  kafka-python==2.0.2 -i https://mirrors.aliyun.com/pypi/simple
# 或者使用requirements.txt
# RUN pip3 install --no-cache-dir -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple

COPY requirements.txt ./

RUN pip3 install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple \
&& pip3 install --no-cache-dir -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple

COPY . .

RUN chmod +x -R /data/deploy/bin

EXPOSE 9091
CMD /data/deploy/bin/start_gunicron
